package org.desktop.web.client.users.proxy;

import java.util.HashMap;
import java.util.Map;

import org.desktop.web.client.user.UserService;
import org.desktop.web.client.user.UserServiceAsync;
import org.desktop.web.shared.domain.entities.User;

import com.google.gwt.core.shared.GWT;
import com.google.gwt.user.client.Cookies;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sencha.gxt.data.client.loader.RpcProxy;
import com.sencha.gxt.data.shared.loader.FilterPagingLoadConfig;
import com.sencha.gxt.data.shared.loader.PagingLoadResult;

public class RpcUsersProxy extends
		RpcProxy<FilterPagingLoadConfig, PagingLoadResult<User>> {

	
	private UserServiceAsync service = GWT.create(UserService.class);
	@Override
	public void load(FilterPagingLoadConfig loadConfig,
			AsyncCallback<PagingLoadResult<User>> callback) {
		Map<String, String> headers = new HashMap<String, String>();
		headers.put("token", Cookies.getCookie("token"));
		service.getUsers(headers, loadConfig, callback);

	}

}
